Menu

Wiki usage

Creative Commons License
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 License.
Edit Sidebar
Main > GivingWeapons

Main.GivingWeapons History

Show minor edits - Show changes to markup

January 31, 2005, at 07:04 PM by bjarne
Changed line 65 from:
to:
January 28, 2005, at 04:13 PM by bjarne
Added lines 1-65:

Giving the player some guns

I'm going to give you the basics on giving the player guns and ammo (in SP). It is very simple and requires the basic knowledge of scripting, mainly getting your script set up to work, I am assuming you know how to do that. ;)

First off in your script you need:

 $player item weapons/colt45.tik

(this goes after level waittill spawn)

Basically you need $player, then the type, item, then the model, weapons/colt45.tik

Use any gun model there in place of the colt.

Now you'll want some extra ammo to go with that thar gun, so you should add:

 $player ammo pistol 32

This gives you 32 rounds of pistol ammo to use, plus what's in the gun already.

You can use these ammo types:

  • pistol
  • rifle
  • smg
  • mg
  • heavy
  • grenade
  • smokegrenade (SH only, I believe)

Now by default you'll having nothing in your hands when you start the level, even if you gave the player a weapon. They have to switch to it to use it. Now say you want the player to start with a certain type of weaon:

 $player useweaponclass mg

That will make you whip out the MG when the level starts (or wherever that is placed). Again you can use any of the above types.

Keep in mind that these aren't just for use when the level starts, for example you could give the player some more ammo when he completes a certain thing, and waits untill he walks through a trigger.

(If you're just starting scripting, ignore this next section, it gets a bit technical)


 level.issomethingcompleted = 1

 give_weapons:
   if(level.issomethingcompleted == 1)
   {
     $sometrigger waittill trigger
     iprintln "Great you completed something and triggered some trigger!"
     iprintln "You'll recieve an award!"
     $player item weapons/mp44.tik//give stg44
     $player ammo mg 200//gives some mg ammo
     $player ammo smg 100//replenish smg ammo
     $player useweaponclass mg//whip out the mg
   }
   else
   {
     goto give_weapons
   }
 end

That's the basics, now you can go implement this knowledge into your level! :D

-blue60007?

Recent Changes Printable View Page History Edit Page [Attributes] [Printable View] [WikiHelp]
Page last modified on January 31, 2005, at 07:04 PM